<html>
<head>
<meta charset="UTF-8">
<title>속성 찾기</title>
<script type="text/javascript">
	function viewAttribute() {
		var attributeName = prompt("찾고자 하는 div 태그의 속성을 입력해주십시오.");
		var element = document.getElementById("testDiv");
		
		alert(element.getAttribute(attributeName));
	}
	
	function viewAllAttributes() {
		var element = document.getElementById("testDiv");
		var attributes = element.attributes;
		
		for (var i = 0, attribute; attribute = attributes[i]; i++) {
			document.write(attribute.nodeName + ": " + attribute.nodeValue + "<br />");
		}
	}
</script>
</head>
<body>
	<button onclick="viewAttribute();"> 
		div 태그의 속성 찾아보기 ex('name', 'title', 'id', 'style')</button>
	<div style="background-color: #888; width: 100px; height: 100px;" 
		title="여행 도우미" id="testDiv" name="js1005"></div>
	<script type="text/javascript">
	viewAllAttributes();
	</script>
</body>
</html>
